from .models import SiteSettings, Navigation


def site_settings(request):
    try:
        settings = SiteSettings.objects.get()
    except SiteSettings.DoesNotExist:
        settings = SiteSettings()  # 如果没有设置，创建一个空的实例
    return {'site_settings': settings}


# 获取导航栏
def navigation(request):
    navs = Navigation.objects.all().order_by('sequence')
    return {'navigations': navs}
